<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibQQt: R:/Develop/a0-develop/LibQQt/src/network/qqtprotocol.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibQQt
   &#160;<span id="projectnumber">v3.1</span>
   </div>
   <div id="projectbrief">开源、跨平台Qt应用程序框架中间件</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_fc4c7f03e1a69a98c370fae55a743828.html">network</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">qqtprotocol.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef QQTPROTOCOL_H</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define QQTPROTOCOL_H</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;QObject&gt;</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;qqt-local.h&gt;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &quot;qqtmessage.h&quot;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;qqtcore.h&quot;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="class_q_qt_protocol.html">   17</a></span>&#160;<span class="keyword">class </span>QQTSHARED_EXPORT <a class="code" href="class_q_qt_protocol.html">QQtProtocol</a> : <span class="keyword">public</span> QObject</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;{</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;    Q_OBJECT</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;    Q_INVOKABLE <span class="keyword">explicit</span> <a class="code" href="class_q_qt_protocol.html">QQtProtocol</a> ( QObject* parent = 0 ) : QObject ( parent ) {</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        detach();</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    }</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="class_q_qt_protocol.html">QQtProtocol</a>() {</div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    }</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    <span class="comment">/*</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">     * 建议：用户在继承类里的函数里直接调用[emit] write(...)</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">    */</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;signals:</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    qint64 write ( <span class="keyword">const</span> QByteArray&amp; );</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <span class="comment">/*</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="comment">     * 以下函数，用户必须继承下去，重写，need override</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="comment">     */</span></div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="class_q_qt_protocol.html#a2b00f53d3dd0eed817eeecff422891f3">   41</a></span>&#160;    <span class="keyword">inline</span> <span class="keyword">virtual</span> quint16 <a class="code" href="class_q_qt_protocol.html#a2b00f53d3dd0eed817eeecff422891f3">minlength</a>() { <span class="keywordflow">return</span> 0; }</div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="class_q_qt_protocol.html#af41bc3116abbbcfc9af45e151a253ff7">   46</a></span>&#160;    <span class="keyword">inline</span> <span class="keyword">virtual</span> quint16 <a class="code" href="class_q_qt_protocol.html#af41bc3116abbbcfc9af45e151a253ff7">maxlength</a>() { <span class="keywordflow">return</span> 0x7FFF; }</div><div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="class_q_qt_protocol.html#a00fd0c1ac23379ed3b9b25da9a34f39b">   53</a></span>&#160;    <span class="keyword">inline</span> <span class="keyword">virtual</span> quint16 <a class="code" href="class_q_qt_protocol.html#a00fd0c1ac23379ed3b9b25da9a34f39b">splitter</a> ( <span class="keyword">const</span> QByteArray&amp; ) { <span class="keywordflow">return</span> 0; }</div><div class="line"><a name="l00060"></a><span class="lineno"><a class="line" href="class_q_qt_protocol.html#a35a69c4b89c8cf7459038f40d75e0dc9">   60</a></span>&#160;    <span class="keyword">inline</span> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="class_q_qt_protocol.html#a35a69c4b89c8cf7459038f40d75e0dc9">dispatcher</a> ( <span class="keyword">const</span> QByteArray&amp; ) { <span class="keywordflow">return</span> 0; }</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;signals:</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="keywordtype">void</span> notifyToProtocolManager ( <span class="keyword">const</span> <a class="code" href="class_q_qt_protocol.html">QQtProtocol</a>* <span class="keyword">self</span>, <span class="keyword">const</span> <a class="code" href="class_q_qt_message.html">QQtMessage</a>* message );</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;signals:</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="comment">//句柄被使用和废弃不用都会发射状态改变信号。</span></div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="comment">//status</span></div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    <span class="comment">//0 detach</span></div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="comment">//1 attach</span></div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    <span class="keywordtype">void</span> statusChanged ( <span class="keywordtype">int</span> status );</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="class_q_qt_protocol.html#a80b4de63c9a5bab33c22b7c47bd22c00">   89</a></span>&#160;    <span class="keyword">inline</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_q_qt_protocol.html#a80b4de63c9a5bab33c22b7c47bd22c00">detach</a>() {</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        mIsDetached = <span class="keyword">true</span>;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        statusChanged ( 0 );</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    }</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="keyword">inline</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> attach() {</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;        mIsDetached = <span class="keyword">false</span>;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;        statusChanged ( 1 );</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    }</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keyword">inline</span> <span class="keyword">virtual</span> <span class="keywordtype">bool</span> detached() { <span class="keywordflow">return</span> mIsDetached; }</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="keyword">protected</span>:</div><div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    <span class="keywordtype">bool</span> mIsDetached;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00110"></a><span class="lineno"><a class="line" href="class_q_qt_protocol.html#ad4caa7aadbb04320acc7d653956f51cb">  110</a></span>&#160;    <span class="keyword">inline</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_q_qt_protocol.html#ad4caa7aadbb04320acc7d653956f51cb">initializer</a>() {}</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="comment">/*</span></div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;<span class="comment">     * 以下函数，与用户无关。</span></div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;<span class="comment">     */</span></div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    <span class="comment">//</span></div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;};</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="preprocessor">#endif // QQTPROTOCOL_H</span></div><div class="ttc" id="class_q_qt_protocol_html_a35a69c4b89c8cf7459038f40d75e0dc9"><div class="ttname"><a href="class_q_qt_protocol.html#a35a69c4b89c8cf7459038f40d75e0dc9">QQtProtocol::dispatcher</a></div><div class="ttdeci">virtual bool dispatcher(const QByteArray &amp;)</div><div class="ttdoc">语义解析器 分发报文 /.../quint16 size/.../QByteArray data/.../ </div><div class="ttdef"><b>Definition:</b> qqtprotocol.h:60</div></div>
<div class="ttc" id="class_q_qt_protocol_html_a80b4de63c9a5bab33c22b7c47bd22c00"><div class="ttname"><a href="class_q_qt_protocol.html#a80b4de63c9a5bab33c22b7c47bd22c00">QQtProtocol::detach</a></div><div class="ttdeci">virtual void detach()</div><div class="ttdef"><b>Definition:</b> qqtprotocol.h:89</div></div>
<div class="ttc" id="class_q_qt_protocol_html_a2b00f53d3dd0eed817eeecff422891f3"><div class="ttname"><a href="class_q_qt_protocol.html#a2b00f53d3dd0eed817eeecff422891f3">QQtProtocol::minlength</a></div><div class="ttdeci">virtual quint16 minlength()</div><div class="ttdoc">最小包长 </div><div class="ttdef"><b>Definition:</b> qqtprotocol.h:41</div></div>
<div class="ttc" id="class_q_qt_protocol_html_af41bc3116abbbcfc9af45e151a253ff7"><div class="ttname"><a href="class_q_qt_protocol.html#af41bc3116abbbcfc9af45e151a253ff7">QQtProtocol::maxlength</a></div><div class="ttdeci">virtual quint16 maxlength()</div><div class="ttdoc">最大包长 </div><div class="ttdef"><b>Definition:</b> qqtprotocol.h:46</div></div>
<div class="ttc" id="class_q_qt_protocol_html_ad4caa7aadbb04320acc7d653956f51cb"><div class="ttname"><a href="class_q_qt_protocol.html#ad4caa7aadbb04320acc7d653956f51cb">QQtProtocol::initializer</a></div><div class="ttdeci">virtual void initializer()</div><div class="ttdef"><b>Definition:</b> qqtprotocol.h:110</div></div>
<div class="ttc" id="class_q_qt_message_html"><div class="ttname"><a href="class_q_qt_message.html">QQtMessage</a></div><div class="ttdoc">语法类 定义报文格式 </div><div class="ttdef"><b>Definition:</b> qqtmessage.h:10</div></div>
<div class="ttc" id="class_q_qt_protocol_html"><div class="ttname"><a href="class_q_qt_protocol.html">QQtProtocol</a></div><div class="ttdoc">The QQtProtocol class very good ideology and impliment. </div><div class="ttdef"><b>Definition:</b> qqtprotocol.h:17</div></div>
<div class="ttc" id="class_q_qt_protocol_html_a00fd0c1ac23379ed3b9b25da9a34f39b"><div class="ttname"><a href="class_q_qt_protocol.html#a00fd0c1ac23379ed3b9b25da9a34f39b">QQtProtocol::splitter</a></div><div class="ttdeci">virtual quint16 splitter(const QByteArray &amp;)</div><div class="ttdoc">语法解析器 从流中解析报文长度 /.../quint16 size/.../.../... </div><div class="ttdef"><b>Definition:</b> qqtprotocol.h:53</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
